﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Clinica_Frba.AbmdeRol
{
    public partial class Modificacion : Form
    {
        public Modificacion()
        {
            InitializeComponent();
            string comando;
            SqlConnection myConnection = new SqlConnection(publico.ConnectionString);
            myConnection.Open();
            comando = "SELECT * FROM DUNDER_MIFFLIN.ROL";
            SqlDataAdapter da = new SqlDataAdapter(comando, myConnection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;
        }
        





        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            int ide;
            SqlConnection myConnection = new SqlConnection(publico.ConnectionString);
            myConnection.Open();
            if (dataGridView1.SelectedRows.Count > 1) { return; }
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                ide = Convert.ToInt32(row.Cells[0].Value);
                new edit(ide).Show();
            }
            string comando;
            comando = "SELECT * FROM DUNDER_MIFFLIN.ROL";
            SqlDataAdapter da = new SqlDataAdapter(comando, myConnection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;
        }

        private void Modificacion_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            string comando;
            SqlConnection myConnection = new SqlConnection(publico.ConnectionString);
            myConnection.Open();
            comando = "SELECT * FROM DUNDER_MIFFLIN.ROL";
            SqlDataAdapter da = new SqlDataAdapter(comando, myConnection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            dataGridView1.DataSource = dt;
        }
    }
}
